package com.atguigu.tingshu.album.mapper;

import com.atguigu.tingshu.model.album.AlbumStat;
import com.atguigu.tingshu.vo.album.AlbumStatVo;
import com.atguigu.tingshu.vo.album.TrackStatMqVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface AlbumStatMapper extends BaseMapper<AlbumStat> {


    AlbumStatVo selectAlbumStatVo(Long albumId);

    @Update("UPDATE album_stat SET stat_num = stat_num+#{vo.count} , update_time=NOW()\n" +
            "WHERE album_id = #{vo.albumId} AND stat_type = #{statType} AND is_deleted = 0;")
    void updateTrackStat(@Param("vo") TrackStatMqVo trackStatMqVo,@Param("statType") String statType);
}
